package com.server;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;

public class HttpResponse implements Response {
	private Socket client;
	private int status;
	private Map<String, String> map = new HashMap<String, String>();

	public HttpResponse(Socket client) {
		this.client = client;
	}


	@Override
	public void init() {

	}

	@Override
	public void addHeader(String key, String value) {
		map.put(key, value);
	}

	@Override
	public void setStatus(int status) {
		this.status = status;

	}

	public PrintWriter getPrintWriter() {
		try {
			OutputStream outputStream = client.getOutputStream();
			PrintWriter print = new PrintWriter(outputStream,true);
			return print;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}


	@Override
	public OutputStream getOut() {
		try {
			return client.getOutputStream();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
